package com.lglbc.server;

import com.lglbc.hello.Mode;
import com.lglbc.hello.OpenAPIGrpc;
import io.grpc.stub.StreamObserver;

public class Service extends OpenAPIGrpc.OpenAPIImplBase {
    @Override
    public void serverStreaming(Mode.Request request, StreamObserver<Mode.Response> responseObserver) {
        for (int i = 0; i < 10; i++) {
            // 发送多个响应消息
            Mode.Response response = Mode.Response.newBuilder()
                    .setMessage("服务端消息："+i)
                    .build();
            responseObserver.onNext(response);
        }
        responseObserver.onCompleted();
    }
}
